package com.joesem.sale.client.network.data

import android.os.Parcel
import android.os.Parcelable

/**
 * @Time 2023/3/13 14:55:42
 * @Description
 **/
data class ContactMode(
    val address: String? = "",
    val birthday: String? = "",
    val city_id: Int? = 0,
    var city_name: String? = "",
    val country_id: Int? = 0,
    val country_name: String? = "",
    val county_id: Int? = 0,
    var county_name: String? = "",
    val create_time: String? = "",
    val create_user_id: Int? = 0,
    val customer: Customer? = Customer(),
    val customer_id: Int? = 0,
    val customer_name: String? = "",
    val detail_address: String? = "",
    val duty: String? = "",
    val email: String? = "",
    val gender: String? = "",
    val gender_text: String? = "",
    val id: Int? = 0,
    val is_default: Boolean? = false,
    val name: String? = "",
    val office_phone: String? = "",
    val phone: String? = "",
    val project_role: String? = "",
    val province_id: Int? = 0,
    var province_name: String? = "",
    val status: Int? = 0,
    val update_time: String? = ""
) : Parcelable {
    constructor(parcel: Parcel) : this(
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readParcelable(Customer::class.java.classLoader),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readValue(Boolean::class.java.classLoader) as? Boolean,
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString()
    ) {
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(address)
        parcel.writeString(birthday)
        parcel.writeValue(city_id)
        parcel.writeString(city_name)
        parcel.writeValue(country_id)
        parcel.writeString(country_name)
        parcel.writeValue(county_id)
        parcel.writeString(county_name)
        parcel.writeString(create_time)
        parcel.writeValue(create_user_id)
        parcel.writeParcelable(customer, flags)
        parcel.writeValue(customer_id)
        parcel.writeString(customer_name)
        parcel.writeString(detail_address)
        parcel.writeString(duty)
        parcel.writeString(email)
        parcel.writeString(gender)
        parcel.writeString(gender_text)
        parcel.writeValue(id)
        parcel.writeValue(is_default)
        parcel.writeString(name)
        parcel.writeString(office_phone)
        parcel.writeString(phone)
        parcel.writeString(project_role)
        parcel.writeValue(province_id)
        parcel.writeString(province_name)
        parcel.writeValue(status)
        parcel.writeString(update_time)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<ContactMode> {
        override fun createFromParcel(parcel: Parcel): ContactMode {
            return ContactMode(parcel)
        }

        override fun newArray(size: Int): Array<ContactMode?> {
            return arrayOfNulls(size)
        }
    }
}
